﻿using FremtidensPlejehjem_Infoskærm.Messaging;
using ModelLayer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using Toolbox;

namespace FremtidensPlejehjem_Infoskærm.ViewModels
{
    public class MainViewModel
    {
        private GeneralMessaging _messagingGateway;
        private List<string> _myCollection;
        private ICommand _activityMouseUp;
        private ICommand _dealMouseUp;

        public List<string> MyCollection
        {
            get { return _myCollection; }
            set { _myCollection = value; }
        }

        public ICommand ActivityMouseUp
        {
            get { return _activityMouseUp; }
            set { _activityMouseUp = value; }
        }

        public ICommand DealMouseUp
        {
            get { return _dealMouseUp; }
            set { _dealMouseUp = value; }
        }

        public MainViewModel()
        {
            _messagingGateway = new GeneralMessaging();

            _myCollection = new List<string>();

            string test1 = "Bla";
            string test2 = "Halløj";
            string test3 = "Blablabla";

            _myCollection.Add(test1);
            _myCollection.Add(test2);
            _myCollection.Add(test3);

            ActivityMouseUp = new RelayCommand(new Action<object>(ShowActivity));
            DealMouseUp = new RelayCommand(new Action<object>(ShowDeal));
        }

        public void ShowActivity(object something)
        {
            MessageBox.Show(something.ToString());
        }

        public void ShowDeal(object something)
        {
            MessageBox.Show(something.ToString());
        }

        public List<MenuItem> DailyDeals
        {
            get { return GetDailyDeals(); }
        }
        
        public List<Activity> ActivityList
        {
            get { return TestMethod(); }
        }

        private List<Activity> TestMethod()
        {
            List<Activity> result = new List<Activity>();

            Activity act1 = new Activity("Dans", "Salsa dans");
            act1.ActivityRooms.Add(new ActivityRoom(DateTime.Now.AddDays(2), DateTime.Now.AddDays(2).AddMinutes(2), new Room(1, "Noget med Vand")));

            Activity act2 = new Activity("Spise", "Masser af mad");
            act2.ActivityRooms.Add(new ActivityRoom(DateTime.Now.AddDays(2), DateTime.Now.AddDays(2).AddMinutes(2), new Room(2, "Noget med Ost")));

            Activity act3 = new Activity("Vinsmagning", "Fuld og tosset");
            act3.ActivityRooms.Add(new ActivityRoom(DateTime.Now.AddDays(2), DateTime.Now.AddDays(2).AddMinutes(2), new Room(3, "Noget med Katte")));
            
            result.Add(act1);
            result.Add(act2);
            result.Add(act3);

            return result;
        }

        private List<MenuItem> GetDailyDeals()
        {
            List<MenuItem> result = new List<MenuItem>();

            MenuItem mi1 = new MenuItem("Burgar", "Den er god!", 456, true);
            MenuItem mi2 = new MenuItem("Kage", "Halløj!", 456, true);
            MenuItem mi3 = new MenuItem("Fisk", "Og de fyrreogtyve sømænd", 456, true);

            result.Add(mi1);
            result.Add(mi2);
            result.Add(mi3);

            return result;
        }
    }
}
